# coding = utf-8

'''
预测肿瘤结果分析
'''

import os
from PIL import Image
import numpy as np

def calcuate():
    path = "E:\predict\image_tumor_v1"
    for case_id in sorted(os.listdir(path)):
        case_path = os.path.join(path, case_id)
        case_path = os.path.join(case_path, "predict_tumor")

        data_list = []
        for item in os.listdir(case_path):
            file_name = os.path.join(case_path, item)
            data = Image.open(file_name).convert("L")
            data = np.array(data)
            data[data>0] = 1
            data_list.append(data)
        data_list = np.array(data_list)
        if data_list.sum() < 300000:
            print(case_id, data_list.sum())



if __name__ == '__main__':
    calcuate()